import sys
import subprocess
import time
import runNQueens
from statlib import stats

if __name__ == "__main__":

   opts = sys.argv[1:]

   numero_rainhas = opts[0]
   #mut,xover
   tipo = opts[1]
   max_generation = opts[2]
   mutation_probability = opts[3]
   xover_probability = opts[4]
   tryouts = opts[5]
   population = opts[6]
   variation = opts[7]

   if (variation == "y"):
      if (tipo == "mut"):
	 # analise da influencia da variacao da probalidade de mutacao no tempo de execucao
         for mutation in [j*0.01 for j in range(1, 11)]:
            print str(mutation) + " " + runNQueens.main([max_generation, str(mutation), xover_probability, numero_rainhas, tryouts, population])
      else:
	 # analise da influencia da variacao da probalidade de xover no tempo de execucao
         for xover in [j*0.1 for j in range(1, 6)]:
            print str(xover) + " " + runNQueens.main([max_generation, mutation_probability, str(xover), numero_rainhas, tryouts, population])
   else:
      if (tipo == "mut"):
         print mutation_probability + " " + runNQueens.main([max_generation, mutation_probability, xover_probability, numero_rainhas, tryouts, population])
      else:
         print xover_probability + " " + runNQueens.main([max_generation, mutation_probability, xover_probability, numero_rainhas, tryouts, population])
